package updater;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
public class VersionCheck {

	
	
	
	public static String getVersion (){
		FileReader fr;
		BufferedReader br;
		String version = null;
		try {
			fr = new FileReader("Version.txt");
			br = new BufferedReader(fr);
			version = br.readLine();
			br.close();
			
		} catch (FileNotFoundException e) {
		} catch (IOException e) {
			version ="FEHLER!";
		}
		return version;
				
	}
		
	public static String getServerVersion() throws IOException {
		
		URL myConnection = new URL("http://www.battlefieldclan.de/dzcp/downloads/?action=download&id=2");
		URLConnection connectMe = myConnection.openConnection();
		          
		InputStreamReader lineReader = new InputStreamReader(connectMe.getInputStream());
		BufferedReader buffer = new BufferedReader(lineReader);
		String version = buffer.readLine();
		
		return "4";
		
	}
	
	public static boolean isOutdated() throws Exception{
            return getServerVersion().compareTo(getVersion()) > 0;
	}
	
}
